<?php

namespace app\common\model;

/**
 * 文章模型
 * Class Article
 * @package app\common\model
 */
class Areas extends BaseModel
{
    protected $name = 'areas';

    /**
     * 获取列表数据
     * @param array $param
     * @return \think\Paginator
     * @throws \think\exception\DbException
     */
    public function getList()
    {
        // 查询列表数据
        return $this->order(['id' => ' desc', 'create_time' => 'desc'])->where(['pid' => request()->get('id', 0), 'type' => request()->get('type', 0)])
            ->paginate(15, false, [
                'query' => \request()->request()
            ]);
    }

    public function joins()
    {
        $module = self::getCalledModule() ?: 'common';
        return $this->hasOne("app\\{$module}\\model\\Joins", 'area_id', 'id');
    }
}
